/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Silvia
 */
@Entity
@Table(name = "animal")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Animal.findAll", query = "SELECT a FROM Animal a"),
    @NamedQuery(name = "Animal.findByIdAnimal", query = "SELECT a FROM Animal a WHERE a.idAnimal = :idAnimal"),
    @NamedQuery(name = "Animal.findByIdVisual", query = "SELECT a FROM Animal a WHERE a.idVisual = :idVisual"),
    @NamedQuery(name = "Animal.findByBirthDate", query = "SELECT a FROM Animal a WHERE a.birthDate = :birthDate"),
    @NamedQuery(name = "Animal.findByColor", query = "SELECT a FROM Animal a WHERE a.color = :color"),
    @NamedQuery(name = "Animal.findByHorn", query = "SELECT a FROM Animal a WHERE a.horn = :horn"),
    @NamedQuery(name = "Animal.findByComment", query = "SELECT a FROM Animal a WHERE a.comment = :comment")})
public class Animal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idAnimal")
    private Integer idAnimal;
    @Column(name = "idVisual")
    private Integer idVisual;
    @Column(name = "birthDate")
    @Temporal(TemporalType.DATE)
    private Date birthDate;
    @Size(max = 45)
    @Column(name = "color")
    private String color;
    @Column(name = "horn")
    private Boolean horn;
    @Size(max = 200)
    @Column(name = "comment")
    private String comment;
    @JoinColumn(name = "Breed_idBreed", referencedColumnName = "idBreed")
    @ManyToOne(optional = false)
    private Breed breedidBreed;
    @JoinColumn(name = "AnimalType_idAnimalType", referencedColumnName = "idAnimalType")
    @ManyToOne(optional = false)
    private AnimalType animalTypeidAnimalType;

    public Animal() {
    }

    public Animal(Integer idAnimal) {
        this.idAnimal = idAnimal;
    }

    public Integer getIdAnimal() {
        return idAnimal;
    }

    public void setIdAnimal(Integer idAnimal) {
        this.idAnimal = idAnimal;
    }

    public Integer getIdVisual() {
        return idVisual;
    }

    public void setIdVisual(Integer idVisual) {
        this.idVisual = idVisual;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Boolean getHorn() {
        return horn;
    }

    public void setHorn(Boolean horn) {
        this.horn = horn;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Breed getBreedidBreed() {
        return breedidBreed;
    }

    public void setBreedidBreed(Breed breedidBreed) {
        this.breedidBreed = breedidBreed;
    }

    public AnimalType getAnimalTypeidAnimalType() {
        return animalTypeidAnimalType;
    }

    public void setAnimalTypeidAnimalType(AnimalType animalTypeidAnimalType) {
        this.animalTypeidAnimalType = animalTypeidAnimalType;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAnimal != null ? idAnimal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Animal)) {
            return false;
        }
        Animal other = (Animal) object;
        if ((this.idAnimal == null && other.idAnimal != null) || (this.idAnimal != null && !this.idAnimal.equals(other.idAnimal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Animal[ idAnimal=" + idAnimal + " ]";
    }
    
}
